<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery.min.js"></script>
</head>

<body>
    <div>
        <form action="login" id="f1">
            <input type="text" placeholder="请输入账号">
            <br>
            <input type="text" placeholder="请输入密码">
            <br>
            <input type="submit" value="登录">
        </form>
    </div>

    <script>
        $(()=>{
            $('#f1').submit((e)=>{
                alert('表单被提交')
                e.preventDefault()// 可以阻止表单提交后跳转界面
            })
        })
    </script>
</body>

</html>